<?php 
class WebUser extends CWebUser
{
    /**
     * Overrides a Yii method that is used for roles in controllers (accessRules).
     *
     * @param string $operation Name of the operation required (here, a role).
     * @param mixed $params (opt) Parameters for this operation, usually the object to access.
     * @return bool Permission granted?
     */
    public function checkAccess($operation, $params=array())
    {
    	$pathInfo = Yii::app()->controller->getId();
		//print_r($_SESSION);exit;
        if(strpos($pathInfo, 'admin')=== 0)
        {
        	if (empty($this->id)) {
	            // Not identified => no rights
	            return false;
	        }
	        $superuser = $this->getState("superuser");
	        if ($superuser) {
	            return true; // admin role has access to everything
	        }
	        // allow access if the operation request is the current user's role
	        //return ($operation === $role);
			return false;
        }
        else {
        	parent::checkAccess($operation, $params);
        }   	
    }
}